package com.wuyan.locationdog.adapter

import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.LayoutRes
import com.arcsoft.commonbase.bean.DeviceBeanContent
import com.arcsoft.commonbase.bean.DogFileBeanContent
import com.arcsoft.commonbase.ext.gone
import com.arcsoft.commonbase.ext.loadImageCircleCar
import com.arcsoft.commonbase.ext.visible
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.wuyan.locationdog.R


class TeamDeviceListAdapter(@LayoutRes layoutResId: Int, data: MutableList<DogFileBeanContent>?) :
    BaseQuickAdapter<DogFileBeanContent, BaseViewHolder>(layoutResId, data) {
    var ifSelf: Boolean = false


    override fun convert(holder: BaseViewHolder, item: DogFileBeanContent) {
        holder.apply {
            getView<ImageView>(R.id.deviceAvatarUrl).loadImageCircleCar(item.dogImg)
            getView<TextView>(R.id.deviceName).text = item.dogName

            val imageView = getView<ImageView>(R.id.ivCheck)
            if (item.ifShare) {
                imageView.setImageResource(R.mipmap.alarm_checked)
            } else {
                imageView.setImageResource(R.mipmap.alarm_unchecked)
            }
            if (ifSelf) {
                imageView.visible()
            } else {
                imageView.gone()
            }

        }
    }
}


